<!DOCTYPE html>
<!-- 
Template Name:  SmartAdmin Responsive WebApp - Template build with Twitter Bootstrap 4
Version: 4.5.1
Author: Sunnyat A.
Website: http://gootbootstrap.com
Purchase: https://wrapbootstrap.com/theme/smartadmin-responsive-webapp-WB0573SK0?ref=myorange
License: You must have a valid license purchased only from wrapbootstrap.com (link above) in order to legally use this theme for your project.
-->
<html lang="en">
    <head>
        <th:block th:include="include :: header('Login - - SmartAdmin v4.5.1')" />
		<link rel="stylesheet" media="screen, print" th:href="@{/css/fa-brands.css}">
    </head>
    <!-- BEGIN Body -->
    <!-- Possible Classes

		* 'header-function-fixed'         - header is in a fixed at all times
		* 'nav-function-fixed'            - left panel is fixed
		* 'nav-function-minify'			  - skew nav to maximize space
		* 'nav-function-hidden'           - roll mouse on edge to reveal
		* 'nav-function-top'              - relocate left pane to top
		* 'mod-main-boxed'                - encapsulates to a container
		* 'nav-mobile-push'               - content pushed on menu reveal
		* 'nav-mobile-no-overlay'         - removes mesh on menu reveal
		* 'nav-mobile-slide-out'          - content overlaps menu
		* 'mod-bigger-font'               - content fonts are bigger for readability
		* 'mod-high-contrast'             - 4.5:1 text contrast ratio
		* 'mod-color-blind'               - color vision deficiency
		* 'mod-pace-custom'               - preloader will be inside content
		* 'mod-clean-page-bg'             - adds more whitespace
		* 'mod-hide-nav-icons'            - invisible navigation icons
		* 'mod-disable-animation'         - disables css based animations
		* 'mod-hide-info-card'            - hides info card from left panel
		* 'mod-lean-subheader'            - distinguished page header
		* 'mod-nav-link'                  - clear breakdown of nav links

		>>> more settings are described inside documentation page >>>
	-->
    <body >
    　		
    
        <!-- DOC: script to save and load page settings -->
        
        <script>
        	
            /**
             *	This script should be placed right after the body tag for fast execution 
             *	Note: the script is written in pure javascript and does not depend on thirdparty library
             **/
            'use strict';

            var classHolder = document.getElementsByTagName("BODY")[0],
                /** 
                 * Load from localstorage
                 **/
                themeSettings = (localStorage.getItem('themeSettings')) ? JSON.parse(localStorage.getItem('themeSettings')) :
                {},
                themeURL = themeSettings.themeURL || '',
                themeOptions = themeSettings.themeOptions || '';
            /** 
             * Load theme options
             **/
            if (themeSettings.themeOptions)
            {
                classHolder.className = themeSettings.themeOptions;
                console.log("%c✔ Theme settings loaded", "color: #148f32");
            }
            else
            {
                console.log("%c✔ Heads up! Theme settings is empty or does not exist, loading default settings...", "color: #ed1c24");
            }
            if (themeSettings.themeURL && !document.getElementById('mytheme'))
            {
                var cssfile = document.createElement('link');
                cssfile.id = 'mytheme';
                cssfile.rel = 'stylesheet';
                cssfile.href = themeURL;
                document.getElementsByTagName('head')[0].appendChild(cssfile);

            }
            else if (themeSettings.themeURL && document.getElementById('mytheme'))
            {
                document.getElementById('mytheme').href = themeSettings.themeURL;
            }
            /** 
             * Save to localstorage 
             **/
            var saveSettings = function()
            {
                themeSettings.themeOptions = String(classHolder.className).split(/[^\w-]+/).filter(function(item)
                {
                    return /^(nav|header|footer|mod|display)-/i.test(item);
                }).join(' ');
                if (document.getElementById('mytheme'))
                {
                    themeSettings.themeURL = document.getElementById('mytheme').getAttribute("href");
                };
                localStorage.setItem('themeSettings', JSON.stringify(themeSettings));
            }
            /** 
             * Reset settings
             **/
            var resetSettings = function()
            {
                localStorage.setItem("themeSettings", "");
            }

        </script>
        <div class="page-wrapper auth" th:object="${user}">
            <div class="page-inner bg-brand-gradient">
                <div class="page-content-wrapper bg-transparent m-0">
                    <div class="height-10 w-100 shadow-lg px-4 bg-brand-gradient">
                        <div class="d-flex align-items-center container p-0">
                            <div class="page-logo width-mobile-auto m-0 align-items-center justify-content-center p-0 bg-transparent bg-img-none shadow-0 height-9 border-0">
                                <a href="javascript:void(0)" class="page-logo-link press-scale-down d-flex align-items-center">
                                    <img src="img/logo.png" alt="SmartAdmin WebApp" aria-roledescription="logo">
                                    <span class="page-logo-text mr-1">SmartAdmin WebApp</span>
                                </a>
                            </div>
                           <!--  <a href="page_register.html" class="btn-link text-white ml-auto">
                                Create Account
                            </a> -->
                        </div>
                    </div>
                    <div class="d-flex flex-1" style="background: url(img/svg/pattern-1.svg) no-repeat center bottom fixed; background-size: cover;">
                        <div class="container py-4 py-lg-5 my-lg-5 px-4 px-sm-0 text-white d-flex align-items-center justify-content-center">
                            <form id="js-login" role="form" class="text-center text-white mb-5 pb-5" action="intel_analytics_dashboard.html">
                                <div class="py-3">
                                    <img src="img/demo/avatars/avatar-admin-lg.png" class="img-responsive rounded-circle img-thumbnail" alt="thumbnail">
                                </div>
                                <div class="form-group">
                                    <h3>
                                        <span th:text="${user.userName}"><span>
                                        <small>
                                           	<span th:text="${user.email}"></span>
                                        </small>
                                    </h3>
                                    <p class="text-white opacity-50">Enter password to unlock screen</p>
                                    <div class="input-group input-group-lg">
                                    	<input type="text" name="username" class="form-control" th:value="${user.loginName}" placeholder="用户" hidden="hidden">
                                        <input type="password" name="password" class="form-control" placeholder="Password">
                                        <div class="input-group-append">
                                            <button class="btn btn-success shadow-0" type="button" id="js-lock-btn"><i class="fal fa-key"></i></button>
                                        </div>
                                    </div>
                                </div>
                                <div class="text-center">
                                    <a href="page_login-alt.html" class="text-white opacity-90">Not Dr. Codex Lantern ?</a>
                                </div>
                            </form>
                            <div class="position-absolute pos-bottom pos-left pos-right p-3 text-center text-white">
                                Copyright © 2020 Read-in Smart Technology Co.,Ltd All Rights Reserved. 
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- BEGIN Color profile -->
        <!-- this area is hidden and will not be seen on screens or screen readers -->
        <!-- we use this only for CSS color refernce for JS stuff -->
        <p id="js-color-profile" class="d-none">
            <span class="color-primary-50"></span>
            <span class="color-primary-100"></span>
            <span class="color-primary-200"></span>
            <span class="color-primary-300"></span>
            <span class="color-primary-400"></span>
            <span class="color-primary-500"></span>
            <span class="color-primary-600"></span>
            <span class="color-primary-700"></span>
            <span class="color-primary-800"></span>
            <span class="color-primary-900"></span>
            <span class="color-info-50"></span>
            <span class="color-info-100"></span>
            <span class="color-info-200"></span>
            <span class="color-info-300"></span>
            <span class="color-info-400"></span>
            <span class="color-info-500"></span>
            <span class="color-info-600"></span>
            <span class="color-info-700"></span>
            <span class="color-info-800"></span>
            <span class="color-info-900"></span>
            <span class="color-danger-50"></span>
            <span class="color-danger-100"></span>
            <span class="color-danger-200"></span>
            <span class="color-danger-300"></span>
            <span class="color-danger-400"></span>
            <span class="color-danger-500"></span>
            <span class="color-danger-600"></span>
            <span class="color-danger-700"></span>
            <span class="color-danger-800"></span>
            <span class="color-danger-900"></span>
            <span class="color-warning-50"></span>
            <span class="color-warning-100"></span>
            <span class="color-warning-200"></span>
            <span class="color-warning-300"></span>
            <span class="color-warning-400"></span>
            <span class="color-warning-500"></span>
            <span class="color-warning-600"></span>
            <span class="color-warning-700"></span>
            <span class="color-warning-800"></span>
            <span class="color-warning-900"></span>
            <span class="color-success-50"></span>
            <span class="color-success-100"></span>
            <span class="color-success-200"></span>
            <span class="color-success-300"></span>
            <span class="color-success-400"></span>
            <span class="color-success-500"></span>
            <span class="color-success-600"></span>
            <span class="color-success-700"></span>
            <span class="color-success-800"></span>
            <span class="color-success-900"></span>
            <span class="color-fusion-50"></span>
            <span class="color-fusion-100"></span>
            <span class="color-fusion-200"></span>
            <span class="color-fusion-300"></span>
            <span class="color-fusion-400"></span>
            <span class="color-fusion-500"></span>
            <span class="color-fusion-600"></span>
            <span class="color-fusion-700"></span>
            <span class="color-fusion-800"></span>
            <span class="color-fusion-900"></span>
        </p>
        <!-- END Color profile -->
        <!-- base vendor bundle: 
			 DOC: if you remove pace.js from core please note on Internet Explorer some CSS animations may execute before a page is fully loaded, resulting 'jump' animations 
						+ pace.js (recommended)
						+ jquery.js (core)
						+ jquery-ui-cust.js (core)
						+ popper.js (core)
						+ bootstrap.js (core)
						+ slimscroll.js (extension)
						+ app.navigation.js (core)
						+ ba-throttle-debounce.js (core)
						+ waves.js (extension)
						+ smartpanels.js (extension)
						+ src/../jquery-snippets.js (core) -->
       <th:block th:include="include :: footer" />
      <!-- <script type="text/javascript">
    	
    	/*页面加载时只执行onload 
	　　　　页面关闭时先执行onbeforeunload，最后onunload 
	　　　　页面刷新时先执行onbeforeunload，然后onunload，最后onload  */
		   $(document).ready(function(e) {
			   	console.log(window);
			 	console.log(document.URL);
		    	window.addEventListener('popstate', this.popstateFun,false);
		    	window.history.pushState(null, null, document.URL);
	    		function popstateFun(){
	    	      //监听浏览器回退的回调
	    	      window.history.pushState(null, null, document.URL); //想浏览器跳转记录中添加一条空记录
	    		}
	    	 /* window.removeEventListener('popstate', this.popstateFun); */
		});
		</script> -->
		<script type="text/javascript">
			/* var loc = location.pathname;
			if(loc=="/Smart-HR/lock"){
				loc = loc;
			}
			var loc = loc.substring(10); */
    		console.log(location.pathname);
        	console.log(document.URL);
        	$(function(e){
        		window.addEventListener( "popstate" , function (e) {
        			alert( "我监听到了浏览器的返回按钮事件啦" ); //根据自己的需求实现自己的功能
        			pushHistory();
        		}, false);
        		function pushHistory() {
        			var  state = {
        				title: "title" ,
        				url: "#"
        			};
        			window.history.pushState(state, "title" , "#" );
        		}
        	});
        	</script>
        	<!--  $(document).ready(function(e) { 
        	    var counter = 0;
        	     if (window.history && window.history.pushState) {
	        	    	console.log(window);
	     			 	console.log(document.URL);
        	        $(window).on('popstate', function () {
        	        	alert("不可回退");
        	            window.history.pushState('forward', null, '#');
        	            window.location.href = "a.html";   // 回退时跳转到新页面
        	            window.history.forward(1); 
        	            
        	        });
        	    } 
        	 		window.history.pushState('forward', null, document.URL); //在IE中必须得有这两行
        	 		window.history.forward(1); 
        	}); -->
		
        <script>
            $("#js-lock-btn").click(function(event)
            {	
                // Fetch form to apply custom Bootstrap validation
                var form = $("#js-login")

                if (form[0].checkValidity() === false)
                {
                    event.preventDefault()
                    event.stopPropagation()
                }
				
                form.addClass('was-validated');
                var username = $("input[name='username']").val();
                var password = $("input[name='password']").val();
                var rememberMe = $("input[name='rememberme']").is(':checked');
                $.ajax({
                    type: "post",
                    url: ctx + "/lock/lockpass",
                    data: {
                        "username": username,
                        "password": password,
                        "rememberMe": rememberMe
                    },
                    success: function(r) {
                        if (r.code == 0) {
                        	console.log(ctx+'index');
                            location.href = ctx + "index";
                        } else {
                        	Swal.fire("登录失败!",r.msg,"error");
                        }
                    }
                });
                // Perform ajax submit here...
            });
		
        </script>
    </body>
    <!-- END Body -->
</html>
